package com.yanfan.parking.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.parking.mapper.NjParkingDeviceInfoMapper;
import com.yanfan.parking.domain.NjParkingDeviceInfo;
import com.yanfan.parking.service.INjParkingDeviceInfoService;

/**
 * 设备信息Service业务层处理
 *
 * @author genluo
 * @date 2024-10-31
 */
@Service
public class NjParkingDeviceInfoServiceImpl extends ServiceImpl<NjParkingDeviceInfoMapper, NjParkingDeviceInfo> implements INjParkingDeviceInfoService {
    @Autowired
    private NjParkingDeviceInfoMapper njParkingDeviceInfoMapper;


    /**
     * 查询设备信息列表
     *
     * @param njParkingDeviceInfo 设备信息
     * @return 设备信息
     */
    @Override
    public List<NjParkingDeviceInfo> queryPageList(NjParkingDeviceInfo njParkingDeviceInfo) {
        LambdaQueryWrapper<NjParkingDeviceInfo> lqw = buildQueryWrapper(njParkingDeviceInfo);
        return njParkingDeviceInfoMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njParkingDeviceInfoMapper.queryPageList(njParkingDeviceInfo);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjParkingDeviceInfo> buildQueryWrapper(NjParkingDeviceInfo bo) {
        LambdaQueryWrapper<NjParkingDeviceInfo> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), NjParkingDeviceInfo::getDeviceName, bo.getDeviceName());
        lqw.like(StringUtils.isNotBlank(bo.getOrgName()), NjParkingDeviceInfo::getOrgName, bo.getOrgName());
        return lqw;
    }



}
